<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../lib/OSL/layui/css/layui.css">
    <link rel="stylesheet" href="../lib/fonts/icomoon/style.css">
    <link rel="stylesheet" href="../lib/css/page/users_manage.css">
</head>

<body>
    <!-- 卡片区域 -->
    <div class="layui-card">
        <div class="layui-card-header">
            <span>访客管理</span>
            <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="addUsers">来访登记</button>
        </div>

        <div class="layui-card-body">
            <!-- //搜索区 -->
            <form class="layui-form" id="form_search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <div style="margin-left: 10px;">
                        <button class="layui-btn btn_search" lay-submit lay-filter="formDemo">搜索</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
            <!-- //数据区 -->
            <table class="layui-table">
                <colgroup>
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col width="100" />
                </colgroup>
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>手机号码</th>
                        <th>访问对象</th>
                        <th>访问目的</th>
                        <th>来访时间</th>
                        <th>离宿时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
            <!-- //分页区域 -->
            <div id="pageBox"></div>
        </div>
    </div>

    <script src="../lib/OSL/jquery.js"></script>
    <script type="text/javascript" src="../lib/OSL/layui/layui.all.js"></script>
    <script src="../lib/js/baseAPI.js"></script>
    <script src="../lib/js/page/visit.js"></script>
    <script src="../lib/OSL/template-web.js"></script>

    <!-- 获取所有用户数据的表格模板 -->
    <script type="text/html" id="tpl-table">
        {{each data}}
        <tr>
            <td>{{$value.user_name}}</td>
            <td>{{$value.user_phone}}</td>
            <td>{{$value.visit_name}}</td>
            <td>{{$value.aim}}</td>
            <td>{{$value.start_time}}</td>
            <td>{{$value.end_time}}</td>
            {{if $value.flag ==0}}
            <td>
                <button type="button" class="layui-btn layui-btn-sm btn_checkUser" data_id="{{$value.id}}"
                    style="background-color: #ff006e">离开</button>
            </td>
            {{else}}
            <td>
                <button type="button" class="layui-btn layui-btn-disabled layui-btn-xs">已离开</button>
            </td>
            {{/if}}
        </tr>
        {{/each}}
    </script>
    <!-------------------------------------------------------------------->
    <!-- 添加访客的表格数据模版 -->
    <script type="text/html" id="dialog_addUsers">
        <form class="layui-form" id="form_addUser">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="user_name" required lay-verify="required" placeholder="请输入姓名"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="user_phone" required lay-verify="required|phone" placeholder="请输入手机号"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">访问对象</label>
                <div class="layui-input-block">
                    <input type="text" name="visit_name" required lay-verify="required" placeholder="请输入访问对象姓名"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">访问目的</label>
                <div class="layui-input-block">
                    <textarea name="aim" required placeholder="请输入访问目的" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认添加</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>

</body>

</html>